import type {
  CreateCrudOptionsProps,
  CreateCrudOptionsRet,
} from '@fast-crud/fast-crud';

import type { SopIsvInfoModel } from '#/api/devOperation/sop/model/sopIsvInfoModel';

import { dict } from '@fast-crud/fast-crud';

import { SopIsvInfoApi } from '#/api/devOperation/sop/sopIsvInfo';
import { $t } from '#/locales';

type ContextRef = object;

export function createCrudOptions(
  _props: CreateCrudOptionsProps<
    SopIsvInfoModel.SopIsvInfoResultVO,
    ContextRef
  >,
): CreateCrudOptionsRet<SopIsvInfoModel.SopIsvInfoResultVO> {
  return {
    crudOptions: {
      settings: { viewFormUseCellComponent: false },
      request: {
        addRequest: SopIsvInfoApi.examineRequest,
      },
      form: {
        col: { span: 24 },
        // label 宽度
        labelCol: { span: null, style: { minWidth: '150px' } },
        // layout: 'vertical',
      },
      columns: {
        id: {
          form: { show: false },
        },
        auditStatus: {
          title: $t('devOperation.sop.sopIsvInfo.auditStatus'),
          type: 'dict-radio',
          form: { rules: [{ required: true, message: '必填项' }] },
          dict: dict({
            data: [
              { value: 2, label: '通过' },
              { value: 99, label: '退回' },
            ],
          }),
        },
        reviewComments: {
          title: $t('devOperation.sop.sopIsvInfo.reviewComments'),
          type: 'textarea',
          search: { show: false },
        },
      },
    },
  };
}
